<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="/lib/haha/core/start.js"></script>
    <script type="text/javascript" src="lib/layDate-v5.0.9/layDate-v5.0.9/laydate/laydate.js"></script>
    <link rel="stylesheet" href="CSS/pageNation.css">
    <link rel="stylesheet" href="CSS/news.css">
</head>

<body>
    <div id="header"></div>
    <!-- 内容 -->
    <div class="container">
        <!-- 左侧菜单 -->
        <div class="aside">
            <div class="top">
                <div class="left bg_size">
                    <span>资源分类</span>
                </div>
                <div class="right">
                    <span class="select" id="all">全选</span>
                    <span class="two" id="not">取消</span>
                </div>
            </div>
            <!-- 分类导航栏菜单 -->
            <div class="asideMenu" id='asideMenu1'>
            </div>
        </div>
        <!-- 右侧表格 -->
        <div class="content">
            <!-- 搜索框 -->
            <div class="searchBox flex" id='search_content'>
                <!-- 搜索 -->
                <div class="searchPart flex" id='search'>
                </div>
            </div>
            <!-- 表格 -->
            <!-- 头部 -->
            <!-- 高级检索 -->
            <div id='advanceSearch' style="display: none;"></div>
            <!-- 表格数据 -->
            <div class="tableData" id='knowledgeTable'>
                <span id='KnowledgeMention'
                    style="display: none;text-align: center;padding: 20px 0;background-color: #F8F8F8">暂无数据</span>
                <ul>
                    <script id='knowledgeTableData' type="text/html">
                    <li>
                        <p class="title" title="{{:#data['title']}}" data-sysid="{{:#data['sysId']}}" data-tablename="{{:#data['tableCode']}}" >{{:#data['num']}}、{{:#data['title']}}</p>
                        <ul class="data flex-wrap">
                            <li><span>来源：</span><span class="orange">{{:#data['source']}}</span></li>
                            <li><span>采集时间：</span><span class="red">{{:#data['grabDate'].split(' ')[0].replace('/','-').replace('/','-')}}</span></li>
                            <li><span>发布时间：</span><span class="red">{{:#data['publishDate'].split(' ')[0]}}</span></li>
                            <div class="text">{{:~text(#data,#index)}}</div>
                        </ul>
                    </li>
                </script>
                </ul>
                <!-- 分页 -->
                <div class="pageNation">
                    <div id="test1"></div>
                </div>
            </div>
        </div>
    </div>
    <!-- 脚部 -->
    <div id="footer"></div>
    <script type="text/javascript">
        shared.useLayout("act-1");
        $("#asideMenu1").load("/shared/newsMenu.html");
    </script>
    <script type="text/javascript" src="/lib/layer-v3.1.1/layer/layer.js"></script>
    <script src="/lib/layui/layui.js"></script>
    <script>
        var postTableData = {
            searchKey: '',
            searchValue: '',
            // 当前页
            page: 1,
            // 每页显示条数
            pageSize: 20,
            //高级检索词
            isLimitFive: 1,
            sortArr: []
        };
       var url=config.getQBZXBySortName;
        var callBackPage = function callBack(curr, limit) {
        };
        function   clearSort() {
            
        }
        //按回车调取检索函数
        function goMultiSearch() {
            postTableData.page = 1;
            // 清除排序
            postTableData.orderBySort = "",
                postTableData.orderByValue = "",
                //清除高级检索的在结果中检索
                // 如果路由有参数
                changeValue();

            pageData.tableData(config.getQBZXBySortName, postTableData, 'knowledgeTableData', 'test1', true, '#KnowledgeMention', render(), true, callBackPage);
        }
        function render(data, index) {
            return {
                text: function (data, index) {
                    var wareNameText = data.text.replace(/<[^<>]+>/g, "");
                    if (base.strlen(wareNameText) > 270) {
                        return base.cutStrByByte(wareNameText, 270) + '...'
                    } else {
                        return wareNameText
                    }
                },
            }
        }

        $(function () {
            var sysId = base.getQueryParam('sysId');
            console.log(sysId)
            core.useTemplateAuto('selectArr', config.selectArr, {});
            // 左侧导航栏数据
            shared.ajaxGet(config.getSortName, {}, function callback(res) {
                core.useTemplateAuto('menuData', res, {});
                // 请求表格数据
                // 路由跳转
                changeValue();
                if (sysId) {
        
                    $('.asideMenu>.box .check').removeClass('check').addClass('nocheck');
                    $('p[ data-sysid=' + sysId + ' ]').addClass('gray');
                    $('p[ data-sysid=' + sysId + ' ]').children('.nocheck').removeClass('nocheck').addClass('check');
                    pageData.sortArr = [$('p[ data-sysid=' + sysId + ' ]').attr('data-dbcode')];
                    postTableData.sortArr= [$('p[ data-sysid=' + sysId + ' ]').attr('data-dbcode')];
                }
                
                pageData.tableData(config.getQBZXBySortName, postTableData, 'knowledgeTableData', 'test1', true, '#KnowledgeMention', render(), true, callBackPage);
            })
            // 全选
            $('#all').click(function () {
                $('.asideMenu>.box .nocheck').removeClass('nocheck').addClass('check');
                $(this).addClass('select');
                $('#not').removeClass('select')
            })
            // 取消
            $('#not').click(function () {
                $('.asideMenu>.box .check').removeClass('check').addClass('nocheck')
                $(this).addClass('select');
                $('#all').removeClass('select');

            })
            // 点击检索事件
            $('#searchBtn').click(function () {
                goMultiSearch();
            })
            //详情页
            $('.tableData').click(function (e) {
                if ($(e.target).hasClass('title')) {
                    window.open('/resourseDetail.html?sysId=' + $(e.target).attr('data-sysid') + '&type=1&tableCode=' + $(e.target).attr('data-tablename'))
                }
            })

        })
        function getMenu() {
            //选择选中的值
            var list = []
            $('#asideMenu1 .check').each(function (index, item) {
                list.push($(item).parent('p').attr('data-dbcode'))
            })
            return list;
        }
        // 获取值
        function changeValue() {
            postTableData.searchKey = $("#searchselect").find("option:selected").val();
            postTableData.searchValue = $("#searchWord").val();
            postTableData.sortArr = getMenu();
            if ($("#searchWord").val() && !base.patrn.test($("#searchWord").val())) {
                 pageData.InsertLog('热点透视','检索',$("#searchWord").val());
            }
        }
    </script>
</body>

</html>